package org.mokusakura.service;

import org.mokusakura.domain.Cart;
import org.mokusakura.domain.Order;
import org.mokusakura.domain.User;

/**
 * @author MokuSakura
 */
public interface PurchaseService {
    /**
     * <p>This method is used to make an order.要求除了orderId, email, orderDate, courier, status以外不为null</p>
     *
     * @param order 要求除了orderId, email, orderDate, courier, status以外不为null
     * @param user  The user who made this order.
     * @param cart  用户的购物车
     * @return Return null if failed. Return an order with id if succeed.
     * @throws Exception 如果库存不够则抛出此异常
     */
    Order makeOrder(Order order, User user, Cart cart) throws Exception;

    /**
     * <p>付款</p>
     *
     * @param order - 订单
     * @return - 返回成功与否
     * @throws Exception -
     */
    Boolean pay(Order order) throws Exception;
}
